package com.yihu.cms.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class FormatDateTime {
   
    
    public static String toLongTimeString(Date dt){
        SimpleDateFormat myFmt=new SimpleDateFormat("HH mm ss SSSS");        
        return myFmt.format(dt);
    }
    public static String toShortTimeString(Date dt){
        SimpleDateFormat myFmt=new SimpleDateFormat("yyyy/MM/dd HH:mm");        
        return myFmt.format(dt);
    }
    public static String toShortTimeString3(Date dt){
        SimpleDateFormat myFmt=new SimpleDateFormat("yyyy-MM-dd HH:mm");        
        return myFmt.format(dt);
    }
    public static String toShortTimeString2(Date dt){
        SimpleDateFormat myFmt=new SimpleDateFormat("yyyyMMdd");        
        return myFmt.format(dt);
    }
    
    public static Date formatToDate(String s){
        SimpleDateFormat myFmt=new SimpleDateFormat("yy-MM-dd");    
        Date date = null;
		try {
			date = myFmt.parse(s);
		} catch (ParseException e) {
			e.printStackTrace();
		}
        return date;
    }
    public static Date formatToDate2(String s){
        SimpleDateFormat myFmt=new SimpleDateFormat("yy-MM-dd HH:mm");    
        Date date = null;
		try {
			date = myFmt.parse(s);
		} catch (ParseException e) {
			e.printStackTrace();
		}
        return date;
    }
    public static long getCurrentTime(){
    	return System.currentTimeMillis();
    }
}
